function Rectangle(name, width, height) {
  this.name = name;
  this.width = width;
  this.height = height;
  this.area = function () {
  	return this.width * this.height;
  };
}


const rect1 = new Rectangle("矩形 1", 20, 20);
const rect2 = new Rectangle("矩形 2", 30, 20);

console.log(rect1.name); // 输出：矩形 1
console.log(rect2.width); // 输出：30
console.log(rect1["width"]); // 输出：20

rect1.color = "红⾊";
console.log(rect1);
// 输出：Rectangle { name: '矩形 1', width: 20, height: 20, area: [Function], color: '红⾊' }

rect2.perimeter = function () {
  return 2 * (rect2.width + rect2.height);
  };
  console.log(rect2.perimeter()); // 输出：100
